#include <iostream>
#include "MutexLock.h"
#include "MutexLockGuard.h"
#include "Thread.h"
using std::cout;
using std::endl;

int cnt = 0;
MutexLock mutexLock;
struct Count: public Thread{
public:
    void run() override{
        for(long long i = 0; i < 1000000 ; i++){
            MutexLockGuard mutexLockGuard(mutexLock);
            cnt++;
        }
    }
};

int main() {
    Count count1;
    Count count2;
    count1.start();
    count2.start();

    count1.stop();
    count2.stop();
    cout << cnt << endl;
    return 0;
}

